﻿#region << 版 本 注 释 >>
/*----------------------------------------------------------------
 * 修改人：x
 * 时间：
 * 修改说明：
 *----------------------------------------------------------------*/
#endregion << 版 本 注 释 >>using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Data.SqlClient;
using seejee_Backendium.Core.Interfaces;
using seejee_Backendium.Core.Interfaces;
using seejee_Backendium.Core.Models;
using seejee_Backendium.Core.Models;
using seejee_Backendium.Core.Models.DTO;
using seejee_Backendium.Data.Repositores;
using seejee_Backendium.Data.Repositores;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace seejee_Backendium.Data.Services
{
    public class OperatorService : IOperatorService
    {
        private readonly OperatorRepository _operatorRepository;

        public OperatorService(OperatorRepository operatorRepository)
        {
            _operatorRepository = operatorRepository;
        }
        public OperatorLoginResult ValidateOperator(string cOperatorName, string cOperatorPassword, bool forceLogin) => _operatorRepository.ValidateOperator(cOperatorName, cOperatorPassword, forceLogin);
        public OperatorLoginResult ValidateBIOperator(string cOperatorName, string cOperatorPassword, bool forceLogin) => _operatorRepository.ValidateBIOperator(cOperatorName, cOperatorPassword, forceLogin);
        public bool SaveToken(string cOperatorName, string tokenString) => _operatorRepository.SaveToken(cOperatorName, tokenString);
        public PagedResult<OperatorInfoDTO> GetAllOperator(int pageIndex, int pageSize, string keyword) => _operatorRepository.GetAllOperator(pageIndex, pageSize, keyword);
        public bool UpdatePassword(OperatorPasswordDTO operatorUpdatePassword) => _operatorRepository.UpdatePassword(operatorUpdatePassword);
        public bool UpdateOldPassword(string oldPassword, string newPassword, string cOperatorName) => _operatorRepository.UpdateOldPassword(oldPassword, newPassword, cOperatorName);
        public bool InsertOperator(OperatorInsertDTO users) => _operatorRepository.InsertOperator(users);
        public bool UpdateOperator(UpdateOperatorDTO user) => _operatorRepository.UpdateOperator(user);

        public bool DeleteOperator(string cOperatorName) => _operatorRepository.DeleteOperator(cOperatorName);
        public bool UpdateOperatorOnlineStatus(string operatorName, bool isOnline) => _operatorRepository.UpdateOperatorOnlineStatus(operatorName, isOnline);
        public bool UpdateLastTime(string operatorName) => _operatorRepository.UpdateLastTime(operatorName);
        public bool SaveImage(string Base64Image, string cOperatorName) => _operatorRepository.SaveImage(Base64Image, cOperatorName);
        public string GetImage(string cOperatorName) => _operatorRepository.GetImage(cOperatorName);
        public bool UpdateStateAsync(int iOperatorID, bool state) => _operatorRepository.UpdateStateAsync(iOperatorID, state);
    }
}
